let price ='123456789';
// /\d{3}$/
// let reg=/(?=\d{3}$)/g;
// let reg=/(?=(\d{3})+$)/g
let reg=/(?!^)(?=(\d{3})+$)/g
console.log(price.replace(reg,','),price.match(reg))